#include <algorithm>
#include <iostream>
#include <iterator>
#include <vector>
template<class InputIterator, class OutputIterator>
InputIterator copy_n(InputIterator first, InputIterator last, OutputIterator result, int Size)
{
	while (first!=last && Size)
	{ 
		*result++ = *first++;
		--Size;
	}
	return first;
}
int main(int argc, char **argv)
{
	int myints[]={1,2,3,4,5,6,7};
	std::vector<int> myvector;
	myvector.resize(7);   // allocate space for 7 elements
	std::copy( myints, myints+7, myvector.begin() );

	const int maxCount = 2;
	for(std::vector<int>::iterator it = myvector.begin(); it != myvector.end(); )
	{
		std::vector<int> v;
		it = copy_n( it, myvector.end(), std::back_inserter(v), maxCount);
		std::copy(v.begin(), v.end(), std::ostream_iterator<int>(std::cout, " "));
		std::cout << std::endl;
	}
	return 0;
}
